package com.example.controller;

import com.example.pojo.DataSum;
import com.example.pojo.Result;
import com.example.service.DataSumService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class DataSumController {
    @Autowired
    private DataSumService dataSumService;

    @GetMapping("/dataSum")
    public Result getDataSum() {
        DataSum dataSum = new DataSum();
        dataSum.setArticleCount(dataSumService.getArticleCount());
        dataSum.setCategoryCount(dataSumService.getCategoryCount());
        dataSum.setAuthorCount(dataSumService.getAuthorCount());
        return Result.success(dataSum);
    }

}
